<%@ page contentType="text/html; charset=UTF-8" %>

<%@ taglib uri="/WEB-INF/tld/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/tld/extend.tld" prefix="extend"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
	<head>
		<title>乐盈培训网 - 添加课程</title>
		<link href="<extend:contextPath name="contextPath"/>/css/style.css" rel="stylesheet" type="text/css" />
		<script language="JavaScript" src="<extend:contextPath name="contextPath"/>/scripts/jquery.js"></script>
		<script language="JavaScript" src="<extend:contextPath name="contextPath"/>/scripts/ESONCalendar.js"></script>
		<script language="JavaScript" src="<extend:contextPath name="contextPath"/>/scripts/common.js"></script>		
	</head>
	<script type="text/javascript">
		function getTeacherByCategory(category)
		{			
			//提交时 中文乱码问题
			//var post = "/qiyexuexi/admin/getTeacherByCategory.do?method=getTeacherByCategory&category=" + category + "&jsoncallback=?";
			var post = "<extend:contextPath name="contextPath"/>/admin/getTeacherByCategory.do?method=getTeacherByCategory&category=" + category;
			post = encodeURI(post);
  			post = encodeURI(post);
		
			//添加繁忙图片
			var  courseTeacherTR = document.getElementById("courseTeacher");
			var  td = document.createElement("td");
			var image = new Image();
			//image.id = "busy";
			image.src = "<extend:contextPath name="contextPath"/>/images/busy.gif";
			
			td.appendChild(image);
			courseTeacherTR.appendChild(td);
			
		
			$.getJSON(post,
				function(json) {
				
					var courseTeacher = document.getElementsByName("courseTO.courseTeacher");
				
					courseTeacher[0].options.length = 0;				
					courseTeacher[0].options.add(new Option("--请选择--", ""));
					
					$.each(json, function(i){
						var down = json[i];
						for(var j = 0; j < down.length; j++) {
							courseTeacher[0].options.add(new Option(down[j].value, down[j].key));			
						}
						
						//移除 繁忙图片
						courseTeacherTR.removeChild(td);
					});
				}
			);		
		}
	
	</script>
	
<body>
	
	<div style="position:absolute; height:100%; width:1045px;">	
		<jsp:include page="../header.jsp"></jsp:include>
		<table width="100%" border="0" cellpadding="0" cellspacing="0" style="font-size:12px;">
				<tr>
					<td height="25px">
						您现在的位置：<a href="<extend:contextPath name="contextPath"/>" class="normal_link">首页</a> >> 
						<a href="<extend:contextPath name="contextPath"/>/admin/goToAdmin.do" class="normal_link">admin</a> >> 添加课程
					</td>
				</tr>
			</table>
		
	<html:form action="/addCourseProcess.do?method=addCourse">
		<table width="100%" style="font-size:14px;">
			<tr>
				<td width="130px">课程名称:</td>
				<td><html:text property="courseTO.courseTitle" size="50"/></td>
			</tr>
			<tr>
				<td>课程时间:</td>
				<td><html:text property="courseTO.coursePeriod" /></td>
			</tr>
			<tr>
				<td>课程开始时间:</td>
				<td>
					<%--<html:text property="courseTO.courseStartTimeAsStr" value="2010-09-05"/>--%>
					<input type="text" id="courseTO.courseStartTimeAsStr" name="courseTO.courseStartTimeAsStr"/>
				</td>
					<script>
    					ESONCalendar.bind("courseTO.courseStartTimeAsStr");
					</script>
			</tr>
			<tr>
				<td>课程价格:</td>
				<td><html:text property="courseTO.coursePrice" />&nbsp; 元</td>
			</tr>
			<tr>
				<td>课程所在城市:</td>
				<td><html:text property="courseTO.courseCity" /></td>
			</tr>
			<tr>
				<td>课程类别:</td>
				<td>
					<html:select property="courseTO.courseCategory" 
						onmouseover="getCourseCategory('courseTO.courseCategory');"
						onchange="getTeacherByCategory(this.value);">
						<html:option value="">--请选择--</html:option>
					</html:select>
				</td>
			</tr>
			<tr>
				<td>课程目标:</td>
				<td><html:textarea property="courseTO.courseTarget" /></td>
			</tr>
			<tr>
				<td>课程发起人:</td>
				<td><html:text property="courseTO.courseSponsor" /></td>
			</tr>
			<tr>
				<td>课程联系电话:</td>
				<td><html:text property="courseTO.courseTelphone" /></td>
			</tr>
			<tr>
				<td>课程联系人:</td>
				<td><html:text property="courseTO.courseContact" /></td>
			</tr>
			<tr>
				<td>课程背景:</td>
				<td><html:textarea property="courseTO.courseBackground" /></td>
			</tr>
			<tr>
				<td>课程主要内容:</td>
				<td><html:textarea property="courseTO.courseMainPoint" cols="80" rows="20"/></td>
			</tr>
			<tr id="courseTeacher">
				<td>课程老师:</td>
				<td>
					<html:select property="courseTO.courseTeacher">
						<html:option value="">--请选择--</html:option>
					</html:select>
				</td>
			</tr>
		</table>
		
		<table width="100%" style="font-size:14px;">
			<tr>
				<td>
					<html:checkbox property="courseTO.isHotCourse" value="Y">是否热门课程</html:checkbox>
					<html:checkbox property="courseTO.isRecommendCourse" value="Y">是否推荐课程</html:checkbox>
					<html:checkbox property="courseTO.isPublicCourse" value="Y">是否公开课程</html:checkbox>
				</td>
			</tr>
			<tr>
				<td>
					<html:submit>提交</html:submit>&nbsp;&nbsp;&nbsp;&nbsp;
				</td>
			</tr>
		</table>
	</html:form>
	</div>
	
	
	</div>		
</body>
	

</html>